gl: Fix glyph cache aging
authorMatthias Clasen <mclasen@redhat.com>
Sun, 2 Jun 2019 20:55:34 +0000 (20:55 +0000)
committerMatthias Clasen <mclasen@redhat.com>
Mon, 3 Jun 2019 02:09:04 +0000 (02:09 +0000)
The logic here seems faulty. We want to keep
a timestamp that tells us when the glyph was
last used, so always update the timestamp.

And whenever we use a glyph, it turns 'young'
again, so remove it from the old pixels
accounting.

The (MAX_AGE, MAX_AGE+CHECK_INTERVAL) interval
is only relevant to prevent us from turning
a cached glyph old more than once, and that
is already taken care of.

gsk/gl/gskglglyphcache.c

index 8f80ac6552f00fde5b26852927a9ae96f8f61fdd..eb2628fb86859388a634f062634bfa6a322a5e4a 100644 (file)
@@ -308,15 +308,15 @@ gsk_gl_glyph_cache_lookup (GskGLGlyphCache *cache,
     {
       const guint age = cache->timestamp - value->timestamp;
 
-      if (MAX_AGE <= age && age < MAX_AGE + CHECK_INTERVAL)
+      if (MAX_AGE <= age)
         {
           GskGLGlyphAtlas *atlas = value->atlas;
 
           if (atlas)
             atlas->old_pixels -= value->draw_width * value->draw_height;
-
-          value->timestamp = cache->timestamp;
         }
+
+      value->timestamp = cache->timestamp;
     }
 
   if (create && value == NULL)